package ee.ut.maxorato_macobo.oop.mud.network;

public class NetSessionEvent extends NetEvent {
	NetSession session;
	String sessionText;
	SessEventType eventType;
	
	public enum SessEventType {
		OPEN,
		CLOSE,
		MESSAGE
	}
	
	public NetSessionEvent(NetSession newSession, SessEventType newEventType, String newSessionText) {
		session = newSession;
		sessionText = newSessionText;
		eventType = newEventType;
	}
	
	@Override
	boolean handle() {
		if(eventType == SessEventType.OPEN) {
			session.sessionOpened();
		}
		else if(eventType == SessEventType.CLOSE) {
			session.sessionClosed();
		}
		else if(eventType == SessEventType.MESSAGE) {
			session.inputHandler(sessionText);
		}
		
		return true;
	}
}
